<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>hello</h1>
</body>
<script>
    var es = new EventSource("/sse1");
    // es.addEventListener("open", function (e) {
    //     console.log("open");
    // })
    // es.addEventListener("javaboy", function (e) {
    //     console.log(e.data, e.lastEventId, e);
    // })
    // es.addEventListener("error", function (e) {
    //     console.log("error")
    //     es.close();
    // })

    es.onopen = function (e) {
        console.log("open")
    };
    es.addEventListener("javaboy", function (e) {
        console.log(e.data, e.lastEventId, e);
    })
    es.onerror = function (e) {
        console.log("error")
        es.close()
    }
</script>
</html>